package com.light.wanting.emoji.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.light.applet.common.result.Result;
import com.light.wanting.emoji.service.WelfareService;
import com.light.wanting.welfare.Welfare;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 活动表(TbWelfare)表控制层
 *
 * @author makejava
 * @since 2024-05-14 13:55:36
 */
@RestController
@RequestMapping("welfare")
public class WelfareController {
    /**
     * 服务对象
     */
    @Resource
    private WelfareService welfareService;

    @GetMapping("/all/{category}")
    public Result<List<Welfare>> selectAll(@PathVariable String category) {
        LambdaQueryWrapper<Welfare> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.like(Welfare::getCategory, category);
        List<Welfare> welfareVos = welfareService.list(queryWrapper);
        return Result.ok(welfareVos);
    }

}

